<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/MES_Project/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">

	$(document).ready(function(){
		var hidden1 = document.createElement("input");
		
		setInterval("refresh()", 3000);
	});	
	
	var id=${id};
	var count=${count};
	
	function refresh(){
		$.ajax({
			url:"reShow_pop.do",
			type:"post",
			data:{"id" :id, "count" :count},
			dataType:"JSON",
			error:function(xhr){
				alert("에러(에러 좀 그만 떠라.) : "+xhr.status);
			},
			success:function(data){
				alert("성공");
				var txt = "";
				txt = txt + "근무자 : " + data.name + "<br>";
				txt = txt + "부서 : " + data.department + "<br>";
				txt = txt + "공정 : " + data.id + "<br>";
				txt = txt + "작업수량 : " + data.operatingCount + "<br>";
				txt = txt + "성공수량 : " + data.successCount + "<br>";
				txt = txt + "실패수량 : " + data.fualtCount + "<br>";
				txt = txt + "남은수량 : " + data.resultCount + "<br>";
				$("#resultLayer").html(txt);
			}
		}); 
		
		//location.reload();
	}

</script>
 <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load('visualization', '1', {packages: ['corechart']});
    </script>
    <script type="text/javascript">
      function drawVisualization() {
        // Some raw data (not necessarily accurate)
        var data = google.visualization.arrayToDataTable([
          ['공정', '작업수량', '성공수량', '실패수량'],
          [ 'mes',  ${operatingCount } ,      ${successCount },        ${fualtCount }    ]
        ]);

        var options = {
          title : '공정',
          vAxis: {title: "Cups"},
          hAxis: {title: "Month"},
          seriesType: "bars",
          series: {5: {type: "line"}},
          trigger: 'none'
        };
        
        var chart = new google.visualization.ComboChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
      google.setOnLoadCallback(drawVisualization);
    </script>
</head>
<body>
	<div id="resultLayer">
		근무자 : ${login_info.employee_name}<br>
		부 서 : ${login_info.employee_department}<br><hr>
		공정${id}<br>
		작업수량 :${operatingCount } <br>
		성공수량 :${successCount } <br>
		실패수량 :${fualtCount } <br>
		남은수량 :${resultCount } <br>
	</div>
	<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>